package com.assisjrs.jpaandroid.sample;

import java.util.HashMap;
import java.util.Map;

import android.app.Activity;
import android.os.Bundle;

import com.assisjrs.jpaandroid.persistence.EntityManager;
import com.assisjrs.jpaandroid.persistence.EntityManagerFactory;
import com.assisjrs.jpaandroid.persistence.Persistence;
import com.assisjrs.jpaandroid.sample.basic.Costumer;

public class MainActivity extends Activity {
	public static EntityManagerFactory entityManagerFactory;

	@Override
	public void onCreate(final Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.main);

		final Map<String, Object> properties = new HashMap<String, Object>();
		properties.put("context", this);

		entityManagerFactory = Persistence.createEntityManagerFactory(this, "jpa-android-sample", properties);
		final EntityManager entityManager = entityManagerFactory.createEntityManager();

		final Costumer c = new Costumer();

		c.setFirstName("Assis");

		entityManager.persist(c);
	}
}